import { reactive, ref, watch } from "vue"
import { defineStore } from "pinia"
interface Sidebar {
  opened: boolean // 侧边栏是否打开
  withoutAnimation?: boolean // 是否关闭动画
}

/** 设置侧边栏状态本地缓存 */


export const useAppStore = defineStore("app", () => {
  /** 侧边栏状态 */
  const sidebar: Sidebar = reactive({
    opened: false,
    // withoutAnimation: false
  })

  /** 切换侧边栏 */
  const toggleSidebar = () => {
    sidebar.opened = !sidebar.opened
  }
  /** 关闭侧边栏 */
//   const closeSidebar = (opened: boolean) => {
//     sidebar.opened = false
//     sidebar.withoutAnimation = withoutAnimation
//   }

  return { sidebar, toggleSidebar }
})
